import { login, getPlatform } from '/services/user';
if (!my.canIUse('plugin') && !my.isIDE) {
  my.ap && my.ap.updateAlipayClient && my.ap.updateAlipayClient();
}
App({
  globalData: {
    // 全局数据
    name: 'alipay',
    token: '',
    userInfo: {},
    apiUrl: 'https://alimi.xiaozubao.net/api/app/',
    playforminfo: {},
    userInfo: {},
    chooseAddressID: 0,
    arealist: []
  },
  async onLaunch(options) {
    // 第一次打开 
    // options.query == {number:1}
    console.info("App onLaunch");
    await my.getAuthCode({
      scopes: 'auth_base',
      success: (res) => {
        login({ 'code': res.authCode }).then((res) => {

        })
      }
    });

    await getPlatform({}).then((res) => {
      if (res.code == "000000") {
        this.globalData.playforminfo = res.data
      }
    })

  },
  onShow(options) {

    // 从后台被 scheme 重新打开
    // options.query == {number:1}
  },
});
